package com.bgs.microservices.service.common.openfeign.email;

import com.bgs.microservices.service.common.openfeign.email.fallback.FailBackEmailServiceImpl;
import com.bgs.microservices.service.common.response.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @ClassName SmsService
 * @Description 远程调度邮箱服务
 * @Author 17179
 * @Date 2023/7/31 11:44
 * @FeignClient name/value 远程调度的微服务名称 path 访问路径的前缀
 *  fallback 熔断异常类
 **/
@FeignClient(name = "microservices-sms",path = "/email",fallback = FailBackEmailServiceImpl.class)
public interface EmailService {

    /**
     * @param text 发送邮件内容
     * @param subject 主题
     * @param to 发给谁
     * @param from 发送者
     */
    @GetMapping("/sendEmail")
    CommonResult sendEmail(@RequestParam("text")String text,@RequestParam("subject")String subject,@RequestParam("to") String to,@RequestParam("from") String from);


    /**
     * 发送带有样式的内容
     * @param context 发送邮件内容 包含html
     * @param subject 主题
     * @param to 发给谁
     * @param from 发送者
     */
    @GetMapping("/sendEmailAndHtml")
    CommonResult sendEmailAndHtml(@RequestParam("context")String context,@RequestParam("subject")String subject,@RequestParam("to")String to,@RequestParam("from")String from);


    /**
     * 发送带有文件（包含普通文件压缩包图片等）的邮件
     * @param text 发送邮件内容
     * @param subject 主题
     * @param to 发给谁
     * @param from 发送者
     */
    @GetMapping("/sendEmailAndFile")
    CommonResult sendEmailAndFile(@RequestParam("text")String text,@RequestParam("subject")String subject,@RequestParam("to")String to,@RequestParam("from")String from,@RequestParam("filepath")String filepath) ;
}
